import Vue from 'vue'
import Router from 'vue-router'
import index from '@/components/index/index'

import order from '@/components/order/index'
import orderPage from '@/components/order/orderPage'

import person from '@/components/person/index'
import login from '@/components/person/login'
import passLogin from '@/components/person/passLogin'
import setup from '@/components/person/setup'
import setPass from '@/components/person/setPass'
import kefu from '@/components/person/kefu'
import invitation from '@/components/person/invitation'
import send from '@/components/person/send'
import queryUserPhoneInfo from '@/components/person/queryUserPhoneInfo'

import home from '@/components/home/index'
import zulin from '@/components/home/zulin'
import huishou from '@/components/home/huishou'
import fenlei from '@/components/home/fenlei'
import list from '@/components/home/list'

import goods from '@/components/goods/index'
import userInfo from '@/components/goods/userInfo'
import succss from '@/components/goods/succss'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      redirect: '/index'
    },
    {
      path: '/index',
      name: 'index',
      redirect: '/index/home'
    },
    {
      path: '/index',
      component: index,
      children: [
        {
          path: 'home',
          redirect: 'home/zulin'
        },
        {
          path: 'home',
          name: 'home',
          component: home,
          children: [
            {
              path: 'zulin',
              name: 'zulin',
              component: zulin
            },
            {
              path: 'huishou',
              name: 'huishou',
              component: huishou
            },
            {
              path: 'fenlei',
              name: 'fenlei',
              component: fenlei
            }
          ]
        },
        {
          path: 'order',
          name: 'order',
          component: order
        },
        {
          path: 'person',
          name: 'person',
          component: person
        }
      ]
    },
    {
      path: '/list',
      name: 'list',
      component: list
    },
    {
      path: '/login',
      name: 'login',
      component: login
    },
    {
      path: '/passLogin',
      name: 'passLogin',
      component: passLogin
    },
    {
      path: '/goods',
      name: 'goods',
      component: goods
    },
    {
      path: '/userInfo',
      name: 'userInfo',
      meta: {
        requireAuth: true, // 添加该字段，表示进入这个路由是需要登录的
        isReal: true
      },
      component: userInfo
    },
    {
      path: '/setup',
      name: 'setup',
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      component: setup
    },
    {
      path: '/setPass',
      name: 'setPass',
      component: setPass
    },
    {
      path: '/succss',
      name: 'succss',
      component: succss
    },
    {
      path: '/orderPage',
      name: 'orderPage',
      component: orderPage
    },
    {
      path: '/kefu',
      name: 'kefu',
      component: kefu
    },
    {
      path: '/invitation',
      name: 'invitation',
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      component: invitation
    },
    {
      path: '/send',
      name: 'send',
      meta: {
        requireAuth: true // 添加该字段，表示进入这个路由是需要登录的
      },
      component: send
    },
    {
      path: '/queryUserPhoneInfo',
      name: 'queryUserPhoneInfo',
      component: queryUserPhoneInfo
    }
  ]
})
